/*
 * BoundParam.java
 *
 * Created on 3 de abril de 2007, 12:30
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package ar.com.mej.db;

/**
 *
 * @author Administrador
 */
public class BoundParam {
  int index; 
  Object value; 
  int sqlType;  
  int scale;   

  public BoundParam(int index, Object value) {
    this(index, value, java.sql.Types.OTHER,false);
  }

  public BoundParam(int index, Object value, int sqlType, boolean minus) {
    this(index, value, sqlType, 0,minus);
  }
  
  public BoundParam(int index, Object value, int sqlType) {
    this(index, value, sqlType, 0, false);
  }

  public BoundParam(int index, Object value, int sqlType, int scale,boolean minus) {
    this.index = index;
    this.sqlType = sqlType;
    this.scale = scale;
        try {
            if(minus){
                this.value = ((String)value).toUpperCase();
            }else{
                this.value = (String)value;
            }
        } catch (Exception e) {
            this.value =value;
        }

  }


  public boolean equals(Object obj){
    if (obj!=null && this.getClass().isInstance(obj)){
      BoundParam bp = (BoundParam)obj;
      if (this.index==bp.index) return true;
    }
    return false;
  }
}
